package com.itheima.d7_arrays;

import java.util.Arrays;
import java.util.Comparator;

public class Student  implements  Comparable<Student> {
    private String name;
    private double height;
    private int age;

    // 指定比较规则
    // this  o
    // 约定1：认为左边对象 大于 右边对象 请您返回正整数
    // 约定2：认为左边对象 小于 右边对象 请您返回负整数
    // 约定3：认为左边对象 等于 右边对象 请您一定返回0

    public int compareTo(Student o) {
        return this.age-o.age;
    };



    public Student() {
    }

    public Student(String name, double height, int age) {
        this.name = name;
        this.height = height;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", height=" + height +
                ", age=" + age +
                '}';
    }



}
